package com.x.provider.api.customer.service;

import com.x.core.web.api.R;
import com.x.core.web.page.PageList;
import com.x.provider.api.customer.constants.ServiceNameConstants;
import com.x.provider.api.customer.model.dto.customer.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "customerService", value = ServiceNameConstants.CUSTOMER_SERVICE)
public interface CustomerRpcService {

    /**
     * 三方登陆，目前支持微信小程序, 返回token,下次方法其它接口是在此Token至于http header Authorization 中，值为 Bear token
     * @param loginExternalReqDTO
     * @return
     */
    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/login/external")
    R<String> loginExternal(@RequestBody LoginExternalReqDTO loginExternalReqDTO);

    /**
     * 注销
     * @return
     */
    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/logout")
    R<Void> logout(@RequestParam("token")String token);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/list")
    R<Map<Long, CustomerDTO>> listCustomer(@RequestBody CustomerListReqDTO listCustomerAO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/authorize")
    R<Long> authorize(@RequestBody CustomerAuthorizeRequestDTO request);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/authorize/user/name/update")
    R<Void> customerUserNameUpdate(@RequestBody CustomerUserNameUpdateReqDTO request);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/follow/list")
    R<List<Long>> listFollow(@RequestParam("customerId") long customerId);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/simple/list")
    R<Map<Long, CustomerSimpleDTO>> listSimpleCustomer(@RequestBody CustomerListReqDTO listSimpleCustomer);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/stat/inc")
    R<Void> addCustomerExp(@RequestBody IncCustomerStatRequestDTO incCustomerStatAO);

    @GetMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/v2/authorize")
    R<Long> authorizeV2(@RequestParam("token") String token, @RequestParam("path") String path, @RequestParam("ip") String ip);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/level/exp/add")
    R<Void> addCustomerExp(@RequestBody CustomerExpAddRequestDTO requestDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/resume/save")
    R<Long> saveCustomerResume(@RequestBody CustomerResumeSaveReqDTO customerResumeSaveReqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/resume/attribute/save")
    R<Void> saveCustomerResumeAttribute(@RequestBody CustomerResumeAttributeSaveReqDTO resumeAttributeReqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/resume/search")
    R<PageList<CustomerResumeDTO>> searchCustomerResume(@RequestBody CustomerResumeSearchReqDTO customerResumeSaveReqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/resource/operate")
    R<Long> operateCustomerResource(@RequestBody CustomerResourceOperReqDTO reqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/relation/customer/id")
    R<PageList<CustomerRelationDTO>> listMyCustomerRelation(@RequestBody CustomerRelationMyReqDTO reqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/relation/update")
    R<CustomerRelationDTO> updateCustomerRelation(@RequestBody CustomerRelationUpdateDTO reqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/verification/save")
    R<Void> saveCustomerVerification(@RequestBody CustomerVerificationSaveReqDTO reqDTO);

    @PostMapping(ServiceNameConstants.CUSTOMER_URL_PREFIX + "/resume/preference/save")
    R<Void> saveCustomerResumePreference(@RequestBody CustomerResumePreferenceSaveReqDTO req);

}
